package shujvjiegou.week3;

import java.util.Scanner;

public class CreateNode {
    static Node head = null;

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        for (int i = 0; i < 3; i++) {
            addLast(scan.next());
        }
        printLink();
    }

    public static void addLast(String str) {
        Node node = new Node(str);
        if (head == null) {
            head = node;
        } else {
            Node temp = head;
            while (temp.next != null) {
                temp = temp.next;
            }
            temp.next = node;
        }

    }

    public static void printLink() {
        Node curNode = head;
        while (curNode != null) {
            System.out.println("[num=" + curNode.sno + ",score=" + curNode.score + "]");
            curNode = curNode.next;
        }
    }
}

class Node {
    int score;
    int sno;
    Node next;

    public Node(String str) {
        String[] strNum = str.split(",");
        this.sno = Integer.parseInt(strNum[0]);
        this.score = Integer.parseInt(strNum[1]);
    }
}

